import Vue from "vue";
// 导入组件
import VueRouter from "vue-router";  
import Home from "../views/Home.vue";
/*
// 如果这个主要是为了验证Home这个组件写的方式会不会需要修改下面的 path的路径，看情况不用改
import Home from "../views/pan/Home.vue";
*/

// 在使用别人的组件时，需要用这句话。  除了axios这个第三方组件。这种文件依赖包一般在node_modules里面
Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "Home",
    component: Home
  },
  {
    path: "/about",
    name: "About",
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/About.vue")
  }
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes
});

export default router;
